package com.info.zhiduoduo.admin.service;

import com.info.zhiduoduo.admin.model.formbean.company.CompanyTaxFormBean;
import com.info.zhiduoduo.common.constants.SmartResult;
import com.info.zhiduoduo.common.formbean.BaseSimpleFormBean;
import com.info.zhiduoduo.repository.dto.company.CompanyTaxDto;
import com.info.zhiduoduo.repository.entity.company.CompanyTax;
import com.info.zhiduoduo.repository.mapper.company.CompanyTaxMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Slf4j
@Service
public class CompanyTaxService {

    @Resource
    CompanyTaxMapper companyTaxMapper;


    public SmartResult<CompanyTaxDto> getCompanyTax(BaseSimpleFormBean<Integer> formBean) {
        CompanyTaxDto companyTaxDto = companyTaxMapper.getCompanyTaxByCompid(formBean.getReqdata());
        return SmartResult.success(companyTaxDto);
    }

    public SmartResult editCompanyTax(BaseSimpleFormBean<CompanyTaxFormBean> formBean) {
        CompanyTaxFormBean reqdata = formBean.getReqdata();
        CompanyTax companyTax = reqdata.toEntity();
        companyTax.insertOrUpdate();
        return SmartResult.success();
    }
}
